package com.mycompany.mvc.utils;

import org.springframework.web.util.WebUtils;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

public class RequestUtil {
    public static Map<String, Object> getReqest(HttpServletRequest request) {
		Map<String, Object> map = WebUtils.getParametersStartingWith(request, "");
		if (map.get("page") != null) {
			int pageNo = Integer.parseInt((String) map.get("page"));
			int pagezize = Integer.parseInt((String) map.get("rows"));
			pageNo = (pageNo - 1) * pagezize;
			map.put("page", pageNo);
		}
		return map;
	}
}